<template>
  <div class="panel-1 flex flex-direction" style="cursor:pointer;" @click="toDeviceFault">
    <div class="title">今日隧道状况分布</div>
    <!--  background-image: linear-gradient(194deg, #FAD77D 0%, #F7A34A 51%, #F58E1D 100%); -->
    <div v-loading="loading" class="flex-sub" style="margin-top: 0.8333vw;display: grid;grid-template-columns: repeat(2, 1fr);grid-template-rows:repeat(2, 1fr);column-gap:0.8333vw;row-gap: 0.8333vw;color: #F5962F;">
      <div style="position: relative; padding: 0.7813vw; border-radius: 9px;background-color:rgba(250, 215, 125, 0.1);">
        <div style="font-size: 0.7292vw;">事故预警</div>
        <div style="font-size: 1.6667vw;font-family: Helvetica;">{{ isNumberStr(info.sgyj)?info.sgyj: '--' }}</div>
        <img style="position: absolute;top: 0.7813vw; right: 0.9896vw;width: 1.6667vw;height: 1.5625vw;" src="~@/assets/images/statistics/sgyj.png">
      </div>
      <div style="position: relative;padding: 0.7813vw; border-radius: 9px;background-color: rgba(250, 215, 125, 0.1);">
        <div style="font-size: 0.7292vw;">故障预警</div>
        <div style="font-size: 1.6667vw;font-family: Helvetica;">{{ isNumberStr(info.gzyj)?info.gzyj: '--' }}</div>
        <img style="position: absolute;top: 0.7813vw; right: 0.9896vw;width: 1.6667vw;height: 1.5625vw;" src="~@/assets/images/statistics/gzyj.png">
      </div>
      <div style="position: relative;padding: 0.7813vw; border-radius: 9px;background-color: rgba(250, 215, 125, 0.1);">
        <div style="font-size: 0.7292vw;">火灾预警</div>
        <div style="font-size: 1.6667vw;font-family: Helvetica;">{{ isNumberStr(info.hzyj)?info.hzyj: '--' }}</div>
        <img style="position: absolute;top: 0.7813vw; right: 0.9896vw;width: 1.6667vw;height: 1.5625vw;" src="~@/assets/images/statistics/hzyj.png">
      </div>
      <div style="position: relative;padding: 0.7813vw; border-radius: 9px;background-color: rgba(250, 215, 125, 0.1);">
        <div style="font-size: 0.7292vw;">故障处置</div>
        <div style="font-size: 1.6667vw;font-family: Helvetica;">{{ isNumberStr(info.gzcz)?info.gzcz: '--' }}</div>
        <img style="position: absolute;top: 0.7813vw; right: 0.9896vw;width: 1.6667vw;height: 1.5625vw;" src="~@/assets/images/statistics/yacz.png">
      </div>
    </div>
  </div>
</template>

<script>
import { getStatisticAlarm } from '@/api/fjgs/statistic.js'
import { isNumberStr } from '@/utils/index'
export default {
  props: {
    queryParams: {
      type: Object,
      default() {
        return {}
      }
    }
  },
  data() {
    return {
      loading: false,
      info: {}
    }
  },
  watch: {
    queryParams: {
      handler: 'getData',
      deep: true
    //   immediate: true
    }
  },
  created() {
    this.getData()
  },
  methods: {
    isNumberStr: isNumberStr,
    toDeviceFault() {
      this.$router.push({
        path: '/sys_jd/warning/monitor/deviceFault'
      })
    },
    getData() {
      this.loading = true
      getStatisticAlarm(this.queryParams).then(res => {
        console.log(res)
        this.info = res.data
      }).finally(_ => {
        this.loading = false
      })
    }
  }
}
</script>

<style lang="scss" scoped>
@import url('./style.scss');
</style>

